<extend name="Public:base" />

<block name="content">

    <form action="{:U('MasterCash/index')}" method="post">
        <div class="table-responsive">
            <table class="table table-striped table-bordered table-hover search-form">
                <thead>
                <tr>
                    <th>
                        时间：  <input id="time1" name="time1" value="{:I('time1')}" class="Wdate" type="text" onfocus="WdatePicker({dateFmt:'yyyy-M-d 00:00:00'})"/>
                        -- <input id="time2" name="time2" value="{:I('time2')}" class="Wdate" type="text" onfocus="WdatePicker({dateFmt:'yyyy-M-d 00:00:00'})"/>
                        <input class="marginL10" name="cash_id" type="text" value="{:I('cash_id')}"  placeholder="提现号"  />
                        <input class="marginL10" name="master_id" type="text" value="{:I('master_id')}"  placeholder="师傅账号"  />
                        <input class="marginL10" name="master_name" type="text" value="{:I('master_name')}"  placeholder="师傅姓名"  />
                        <input class="btn btn-primary radius5 btn-sm" type="submit" value="查询"/>
                        <a class="btn btn-primary radius5 btn-sm" href="{:U('MasterCash/excelout')}">导出</a>
                        <!--  <a class="btn btn-primary" href="javascript:;" id="search" url="{:U('Member/index')}">搜索</a>-->
                    </th>
                </tr>
                </thead>
            </table>
        </div>
    </form>
    <div class="table-responsive">
        <table class="table table-striped table-bordered table-hover" id="mytable">

            <thead>
            <tr>
                <th>提现账单号</th>
                <th>师傅账号</th>
                <th>师傅名称</th>
                <th>提现金额</th>
                <th>到账到户</th>
                <th>申请时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <volist name="list" id="ba" key="k">
                <tr>
                    <td>{$ba['id']}</td>
                    <td>{$ba['phone']}</td>
                    <td>{$ba['id_name']}</td>
                    <td>{$ba['money']}</td>
                    <td>{$ba['name']}{$ba['bank_name']}{$ba['bank_num']}</td>
                    <td>{$ba['add_time']|date="Y-m-d H:i:s",###}</td>
                    <td>
                        <php>if($ba['number'])
                            echo '转账编号：'.$ba['number'].'<br>转账时间：'.$ba['update_time']
                        </php>
                        <php>
                            if(!$ba['number'])
                            echo "<input  class='btn btn-info radius5 btn-xs'  type='button' value='已转账' onclick='tip(".$ba['id'].")'>"
                        </php>
                    </td>
                </tr>
            </volist>
            <tr>
                <td colspan="20" class="page">{$page}</td>
            </tr>
            </tbody>
        </table>
    </div>
</block>
<block name="css">
</block>
<block name="javascript">
    <script>

        function tip(id){
            var html = "<div style='padding:10px;'>转账流水号：<input type='text' id='number1' name='number' /></div>";
            html+="<div style='padding: 10px'>转账时间：<input id='time11' name='time' class='Wdate' type='text' onfocus='"+'WdatePicker({dateFmt:"yyyy-M-d HH:mm:ss"})'+"'/></div>"
            var submit = function (v, h, f) {
                /*if (f.yourname == '') {
                    $.jbox.tip("请输入您的姓名。", 'error', { focusId: "yourname" }); // 关闭设置 yourname 为焦点
                    return false;
                }*/

                $.ajax({
                    url:"{:U('MasterCash/add')}",
                    type:'post',
                    data:{
                        time: f.time,
                        number: f.number,
                        id:id
                    },
                    success:function(data){
                        console.log(data)
                        if(data==1){
                            $.jbox.info('日期不能为空')
                        }else if(data==2){
                            $.jbox.info('流水编号不能为空')
                        }else{
                            window.setTimeout(function () { $.jbox.info('添加成功');location.reload()}, 1000);
                        }
                    }

                })
                console.log(f.number)
                console.log(f.time1)
                console.log(id)
               // $.jbox.tip("你叫：" + f.yourname);
                //$.jBox.tip("你叫：" + h.find("#yourname").val());
                //$.jBox.tip("你叫：" + h.find(":input[name='yourname']").val());

                return true;
            };

            $.jbox(html, { title: "请输入记录", submit: submit });
        }
    </script>
</block>